package com.krain.ddbb.entity;

import android.os.Parcel;
import android.os.Parcelable;

import com.krain.ddbb.constant.Constant;

/**
 * Class description
 *
 * @author yamin
 * @date 2015/12/9 下午 12:33
 */
public class BaseEntity implements Parcelable {

    private String code ;

    private String msg ;

    private String data;

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public String getData() {
        return data;
    }

    public void setData(String data) {
        this.data = data;
    }

    public BaseEntity() {
    }


    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeString(this.code);
        dest.writeString(this.msg);
        dest.writeString(this.data);
    }

    protected BaseEntity(Parcel in) {
        this.code = in.readString();
        this.msg = in.readString();
        this.data = in.readString();
    }

    public static final Parcelable.Creator<BaseEntity> CREATOR = new Parcelable.Creator<BaseEntity>() {
        public BaseEntity createFromParcel(Parcel source) {
            return new BaseEntity(source);
        }

        public BaseEntity[] newArray(int size) {
            return new BaseEntity[size];
        }
    };

    public boolean isOk(){
        return code.equals(Constant.SUCCESS_CODE);
    }
}
